package com.zr.daoImpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;


import com.zr.dao.UpdateteaDao;
import com.zr.util.JDBCUtil;

public class UpdateteaDaoimplljc implements UpdateteaDao{

	@Override
	public boolean updatetea(int tid,String tname, String tage, String tsex, String address, String tpnumber) {
		boolean flag = false;
		StringBuffer sql = new StringBuffer("");
		sql.append(" UPDATE teacher SET");
		sql.append(" tname=?,tage=?,tsex=?,address=?,tpnumber=?");
		sql.append(" WHERE tid=?");
		Connection con = JDBCUtil.getConnection();
		try {
			PreparedStatement pst = con.prepareStatement(sql.toString());
			pst.setString(1, tname);
			pst.setString(2, tage);
			pst.setString(3, tsex);
			pst.setString(4, address);
			pst.setString(5, tpnumber);
			pst.setInt(6, tid);
			int i = pst.executeUpdate();
			if(i>0){
				flag=true;
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}		
		return flag;
	}

}
